import './errorHandler'
export const errorHandler = (err) => {
  console.error(err)
  // console.log(Object.getOwnPropertyNames(err))
  // console.log(err.stack,err.stack.match(/at\sVueComponent.created\s\(\S+\)/))
  if(!self.errorLogUpload) return;
  let stack = err.stack || '',
      errComponent = stack.match(/at\sVueComponent.created\s\(\S+\)/),
      errMsg = errComponent ? err.message + ' ' +errComponent : err.message
  
  self.errorLogUpload({
      logLevel: 4,
      errType: 11, // 11为代码报错，12为资源报错，21为api参数报错，22为api其他报错
      apiError:{
          message: errMsg,
          uri: location.href,
      }
  });
}